package cmpe451.group7.ourcity.dao;

import java.io.*;
import java.util.*;

/**
 * Generic DAO interface for all DAO objects.
 * 
 * @param <T>
 *            DAO type
 */
public interface GenericDAO<T extends Serializable> {

	/**
	 * Save the entity to the database
	 * 
	 * @param entity
	 * @return
	 */
	public boolean save(T entity);

	/**
	 * Remove the entity from the database
	 * 
	 * @param entity
	 * @return
	 */
	public boolean delete(T entity);

	/**
	 * Update or save entity.
	 * 
	 * Used after modification of the object.
	 * 
	 * @param entity
	 * @return
	 */
	public boolean saveOrUpdate(T entity);

	public boolean update(T entity);

	public boolean merge(T entity);

	/**
	 * Get all the entities of the given type.
	 * 
	 * @return Result set containing all entities. Returns null for error cases.
	 */
	public List<T> findAll();

	/**
	 * Find an entity with the given ID
	 * 
	 * @param id
	 *            id of the entity
	 * @return Returns null for error cases.
	 */
	public T findByID(long id);

	public void initialize(Object entity);
}